<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>

<blockquote class="layui-elem-quote"><{$action}></blockquote>

<div class="layui-tab layui-tab-card">
	<ul class="layui-tab-title">
		<li <{if isset($type) AND $type == 1}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/1">网校详情</a></li>
		<li <{if isset($type) AND $type == 2}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/2">网校老师</a></li>
		<!-- <li <{if isset($type) AND $type == 3}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/3">网校课程</a></li> -->
		
		<!-- <li <{if $type == 4}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/4">开通题库分类</a></li>
		<li <{if $type == 5}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/5">开通录播课</a></li> -->
		<li <{if isset($type) AND $type == 6}>class="layui-this"<{/if}>><a href="/school/edit/<{$school_info['id']|default:'0'}>/6">网校权限管理</a></li>
		<li <{if isset($type) AND $type == 7}>class="layui-this"<{/if}>><a href="/subject/school_tiku/0/<{$school_info['id']}>">网校题库</a></li>
		<li <{if isset($type) AND $type == 8}>class="layui-this"<{/if}>><a href="/question_topic/index/0/<{$school_info['id']}>">网校问答&话题</a></li>
		<li <{if isset($type) AND $type == 9}>class="layui-this"<{/if}>><a href="/news/index/0/<{$school_info['id']}>">网校资讯</a></li>
		<li <{if isset($type) AND $type == 11}>class="layui-this"<{/if}>><a href="/school_course?school_id=<{$school_info['id']}>">网校课程</a></li>
		<li <{if isset($type) AND $type == 12}>class="layui-this"<{/if}>><a href="/school/order_record/<{$school_info['id']}>">网校消费记录</a></li>
		<li <{if isset($type) AND $type == 13}>class="layui-this"<{/if}>><a href="/user/index/0/0/0/1/0/0/<{$school_info['id']}>">学员列表</a></li>
		<li <{if isset($type) AND $type == 14}>class="layui-this"<{/if}>><a href="/sys_user/chage_school_pwd/<{$school_info['id']}>">重置密码</a></li>
	</ul>
</div>
<div class="layui-tab-content">
	<{if $type == 1}>
	<div class="layui-tab-item <{if $type == 1}>layui-show<{/if}>">
		<form class="layui-form layui-form-pane" method="post" action="<{$post_url}>" id="form_add_role">
			<input type="hidden" name="id" value="<{$school_info['id']|default:'0'}>" />

			<div class="layui-form-item">
				<label class="layui-form-label">网校名称</label>
				<div class="layui-input-block">
					<input type="text" name="school_name" value="<{$school_info.school_name}>" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">帐号数量</label>
				<div class="layui-input-block">
					<input type="text" name="item_num" value="<{$school_info.item_num}>" class="layui-input" />
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">代理商</label>
				<div class="layui-input-block">
					<select name="agent_id">
						<option value="0" <{if 0 == $school_info['agent_id']}> selected <{/if}>>请选择代理商</option>
						<{foreach from=$agent_list item=agent}>
						<option value="<{$agent.id}>" <{if $agent.id == $school_info['agent_id']}> selected <{/if}>><{$agent.name}></option>
						<{/foreach}>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">审核状态</label>
				<div class="layui-input-block">
					<select name="status">
						<option value="0" <{if 0 == $school_info['status']}> selected <{/if}>>等待审核</option>
						<option value="1" <{if 1 == $school_info['status']}> selected <{/if}>>审核通过</option>
						<option value="2" <{if 2 == $school_info['status']}> selected <{/if}>>审核拒绝</option>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">审核状态</label>
				<div class="layui-input-block">
					<select name="run_status">
						<option value="1" <{if 1 == $school_info['run_status']}> selected <{/if}>>运营中</option>
						<option value="0" <{if 0 == $school_info['run_status']}> selected <{/if}>>停止运营</option>
					</select>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">审核反馈</label>
				<div class="layui-input-block">
					<textarea name="feedback" class="layui-textarea"><{$school_info.feedback}></textarea>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">开始运营日期</label>
				<div class="layui-input-block">
					<input type="text" name="start_date" id="start_time" lay-verify="required|date" placeholder="作业开始时间" autocomplete="off" class="layui-input" value="<{if !empty($school_info.start_date)}><{$school_info.start_date}><{/if}>" >
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">运营结束日期</label>
				<div class="layui-input-block">
					<input type="text" name="end_date" id="end_time" lay-verify="required|date" placeholder="作业结束时间" autocomplete="off" class="layui-input" value="<{if !empty($school_info.end_date)}><{$school_info.end_date}><{/if}>"  >
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">网校域名</label>
				<div class="layui-input-block">
					<input type="text" name="school_domain" value="<{$school_info.school_domain}>" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">联系人</label>
				<div class="layui-input-block">
					<input type="text" name="link_man" value="<{$school_info.link_man}>" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">固定电话</label>
				<div class="layui-input-block">
					<input type="text" name="link_tel" value="<{$school_info.link_tel}>" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">手机号码</label>
				<div class="layui-input-block">
					<input type="text" name="link_phone" value="<{$school_info.link_phone}>" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
                <label class="layui-form-label">学校地址</label>
                <div class="layui-input-inline">
                    <select name="province_code" id="province" lay-filter="province" lay-verify="required">
                        <option value="">请选择省</option>
                        <{foreach from=$province_list item=item }>
                        <option value="<{$item['area_code']}>" <{if isset($school_info) && $school_info['province_code']==$item['area_code'] }>selected<{/if}> ><{$item['area_name']}></option>
                        <{/foreach}>
                    </select>
                </div>
               
                <div class="layui-input-inline">
                    <select name="city_code" id="city" lay-filter="city" lay-verify="required">
                        <option value="">请选择市</option>
                        <{if isset($city_list)}>
                        <{foreach from=$city_list item=item }>
                        <option value="<{$item['area_code']}>" <{if isset($school_info) && $school_info['city_code']==$item['area_code'] }>selected<{/if}> ><{$item['area_name']}></option>
                        <{/foreach}>
                        <{/if}>
                    </select>
                </div>

                <div class="layui-input-inline">
                    <select name="area_code" id="district" lay-filter="district" lay-verify="required">
                        <option value="">请选择区</option>
                        <{if isset($area_list)}>
                        <{foreach from=$area_list item=item }>
                        <option value="<{$item['area_code']}>" <{if isset($school_info) && $school_info['area_code']==$item['area_code'] }>selected<{/if}> ><{$item['area_name']}></option>
                        <{/foreach}>
                        <{/if}>
                    </select>
                </div>
                <input type="hidden" name="province_name" id="province_name" value="<{$school_info['province_name']|default:''}>"/>
                <input type="hidden" name="city_name" id="city_name" value="<{$school_info['city_name']|default:''}>"/>
                <input type="hidden" name="area_name" id="area_name" value="<{$school_info['area_name']|default:''}>"/>
            </div>

			<div class="layui-form-item">
				<label class="layui-form-label">详细地址</label>
				<div class="layui-input-block">
					<input type="text" name="" value="<{$school_info.province_name}> <{$school_info.city_name}> <{$school_info.area_name}> <{$school_info.school_address}>" class="layui-input">
				</div>
			</div>



			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">网校简介</label>
				<div class="layui-input-block">
					<textarea name="school_intro" class="layui-textarea"><{$school_info.school_intro}></textarea>
				</div>
			</div>

			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">网校详细描述</label>
				<div class="layui-input-block">
					<textarea name="description" id="editor1" class="layui-textarea editor"><{$school_info.description}></textarea>
				</div>
			</div>

			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</form>
	</div>
	<{/if}>
	<{if $type == 2}>
	<div class="layui-tab-item  <{if $type == 2}>layui-show<{/if}>">
		<table class="layui-table" lay-even lay-skin="row">
			<thead>
				<tr>
					<th>老师姓名</th>
					<th>所教班级</th>
					<th>所教科目</th>
					<th>是否启用</th>
				</tr>
			</thead>
			<{foreach from=$result item=item}>
				<tr>
					<td class="center"><{$item['teacher_name']}></td>
					<td class="center"></td>
					<td class="center"><{$item['title']}></td>
					<td class="center"><{if $item['status'] == 0}>否<{elseif $item['status'] == 1}>是<{/if}></td>
				</tr>
			<{/foreach}>
			<{if $result|count eq 0}>
				<tr>
					<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
						赞无数据！
					</td>
				</tr>
			<{/if}>
		</table>

		<div class="layui-box layui-laypage layui-laypage-default">
			<{$pagination}>
		</div>
	</div>
	<{/if}>
	<{if $type == 3}>
	<div class="layui-tab-item <{if $type == 3}>layui-show<{/if}>">
		<table class="layui-table" lay-even lay-skin="row">
			<thead>
				<tr>
					<th>班课名称</th>
					<th>类型</th>
					<th>浏览次数</th>
					<th>内容</th>
				</tr>
			</thead>
			<{foreach from=$result item=item}>
				<tr>
					<td class="center"><{$item['title']}></td>
					<td class="center">
						<{if $item['type']==1}>
						视频课
						<{elseif $item['type']==2}>
						直播课
						<{elseif $item['type']==3}>
						面授课
						<{/if}>
					</td>
					<td class="center"><{$item['detail']}></td>
					<td class="center"><{if $item['status'] == 0}>否<{elseif $item['status'] == 1}>是<{/if}></td>
				</tr>
			<{/foreach}>
			<{if $result|count eq 0}>
				<tr>
					<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
						赞无数据！
					</td>
				</tr>
			<{/if}>
		</table>

		<div class="layui-box layui-laypage layui-laypage-default">
			<{$pagination}>
		</div>
	</div>
	<{/if}>
	<{if $type == 4}>
	<div class="layui-tab-item <{if $type == 4}>layui-show<{/if}>">
		<form class="layui-form layui-form-pane" method="post" action="<{$post_url}>" id="form_add_role">
			<input type="hidden" name="id" value="<{$school_info['id']|default:'0'}>" />
			<{foreach from=$result item=cate_item}>
			<fieldset class="layui-elem-field">
				<legend><{$cate_item.name}></legend>
				<div class="layui-form-item">
					<div class="layui-inline">
						<{assign var="status" value=$cate_item.is_bind|default:"0"}>
						<input type="checkbox" <{if $status == 1}> checked<{/if}> name="is_bind[<{$cate_item.id}>]" lay-skin="switch" lay-filter="switchTest" value="1">
					</div>
					<div class="layui-inline">
						<input type="text" name="expire_tiem[<{$cate_item.id}>]" <{if $cate_item.expire_tiem > 0}>value="<{$cate_item.expire_tiem|date_format:'%Y-%m-%d'}>"<{/if}> placeholder="过期时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
					</div>

					<div class="layui-inline">
						<input type="text" style="width:400px;" name="total_code_num[<{$cate_item.id}>]" placeholder="请输入要增加的激活码数量" autocomplete="off" class="layui-input" >
					</div>
					<{if isset($cate_item.total_code_num) AND $cate_item.total_code_num > 0}>
					<div class="layui-inline">
					激活码数量：<{$cate_item.total_code_num}>， 已使用(<{$cate_item.total_code_num-$cate_item.surplus_code_num}>)， 剩余(<{$cate_item.surplus_code_num}>)
					</div>
					<{/if}>
				</div>
			</fieldset>	
			<{/foreach}>
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
			</div>
		</form>
	</div>
	<{/if}>
	<{if $type == 5}>
	<!-- <div class="layui-tab-item <{if $type == 5}>layui-show<{/if}>">
		<form class="layui-form layui-form-pane" method="post" action="<{$post_url}>" id="form_add_role">
			<input type="hidden" name="id" value="<{$school_info['id']|default:'0'}>" />
			<{foreach from=$result item=cate_item}>
			<fieldset class="layui-elem-field">
				<legend><{$cate_item.name}></legend>
				<div class="layui-form-item">
					<div class="layui-inline">
						<{assign var="status" value=$cate_item.is_course_bind|default:"0"}>
						<input type="checkbox" <{if $status == 1}> checked<{/if}> name="is_course_bind[<{$cate_item.id}>]" lay-skin="switch" lay-filter="switchTest" value="1">
					</div>
					<div class="layui-inline">
						<input type="text" name="expire_tiem[<{$cate_item.id}>]" <{if $cate_item.expire_tiem > 0}>value="<{$cate_item.expire_tiem|date_format:'%Y-%m-%d'}>"<{/if}> placeholder="过期时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
					</div>

					<div class="layui-inline">
						<input type="text" style="width:400px;" name="total_code_num[<{$cate_item.id}>]" placeholder="请输入要增加的激活码数量" autocomplete="off" class="layui-input" >
					</div>
					<{if isset($cate_item.total_code_num) AND $cate_item.total_code_num > 0}>
					<div class="layui-inline">激活码数量：<{$cate_item.total_code_num}>， 已使用(<{$cate_item.total_code_num-$cate_item.surplus_code_num}>)， 剩余(<{$cate_item.surplus_code_num}>)
					</div>
					<{/if}>
				</div>
			</fieldset>	
			<{/foreach}>
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
			</div>
		</form>
	</div> -->
	<table class="layui-table" lay-even lay-skin="row">
		<thead>
			<tr>
				<th width="30">ID</th>
				<th width="350">课程</th>
				<th width="180">价格</th>
				<th width="220">上架时间</th>
				<th width="120">是否授权</th>
				<th>激活码数量</th>
			</tr>
		</thead>   
		<tbody>
		<{foreach from=$result item=item}>
			<tr>
				<td class="not_lb tal"><!-- <input name="ids[]" type="checkbox"> --><{$item.id}></td>
				<td class="not_lb tal">
					<div class="product_name">
						<!-- <div class="t_img"><img src="https://g-search2.alicdn.com/img/bao/uploaded/i4/i3/TB1BUybHFXXXXakXpXXXXXXXXXX_!!0-item_pic.jpg_250x250.jpg" /></div> -->
						<div class="t_info">
							<a class="fs20" href="javascript:;">
								<{$item.title}>
							</a>
							<div>课时：
								<{$item.course_time}>课时</div>
						</div>
					</div>
				</td>
				<td class="not_lb tal"><span class="c-ff6d5e">¥<{$item.price}>元</span></td>
				<td class="not_lb tal">
					<{$item[ 'add_time']|date_format: '%Y-%m-%d <br> %H:%M:%S'}>
				</td>
				<td class="not_lb tal">
					是
				</td>
				<td class="not_lb tal">
					<div class="layui-inline">
						<input type="text" style="width:400px;" name="total_code_num[<{$cate_item.id}>]" placeholder="请输入要增加的激活码数量" autocomplete="off" class="layui-input" >
					</div>
					<button class="layui-btn" lay-submit lay-filter="*">提交</button>
				</td>
			</tr>
		<{/foreach}>
		<{if $result|count eq 0}>
			<tr>
				<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
					赞无数据！
				</td>
			</tr>
		<{/if}>
		<tr>
			<td class="center" colspan="12">
				<!-- <input type="checkbox" lay-filter="checkbox_all" title="全选">
				<button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button> -->
			</td>
		</tr>
		</tbody>
	</table>
	<div class="layui-box layui-laypage layui-laypage-default">
		<{$pagination}>
	</div>
	<{/if}>
	<{if $type == 6}>
	<div class="layui-tab-item <{if $type == 6}>layui-show<{/if}>">
		<form class="layui-form layui-form-pane" method="post" action="<{$post_url}>">
			<input type="hidden" name="school_id" value="<{$school_info['id']|default:'0'}>" />
			<input type="hidden" name="privilege" value="1" />
			<div class="layui-inline">
				<div class="layui-input-block" style=" margin-left: 0; padding-bottom:18px;">
					<input type="checkbox" title="允许上传视频" name="upload_video" <{if $school_privileges.upload_video == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许发布视频网课" name="video_course" <{if $school_privileges.video_course == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许直播" name="live" <{if $school_privileges.live == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许发布线下面授课" name="offline_course" <{if $school_privileges.offline_course == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许发布题目" name="add_topic" <{if $school_privileges.add_topic == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许发布组卷" name="add_topic_volumes" <{if $school_privileges.add_topic_volumes == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许发布实训" name="add_train" <{if $school_privileges.add_train == 1}>checked<{/if}> value="1">

					<input type="checkbox" title="允许提现" name="tixian" <{if $school_privileges.tixian == 1}>checked<{/if}> value="1">
				</div>
			</div>
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
			</div>
		</form>
	</div>
	<{/if}>
</div>

<{include file="public_html/footer.html"}>
<script>
    layui.use(['laydate', 'form'], function(){
        var laydate = layui.laydate, form = layui.form();

        form.on('select(province)',function(data){
            var ii = layer.load();
            var province_code = data.value;
            $("#province_name").val($("#province option:selected").text())
            $("#city_name").val('');
            $("#area_name").val('');
            $("#city").html('<option value="">请选择城市</option>');
            $("#district").html('<option value="">请选择区域</option>');
            form.render('select');
            $.ajax({
                type: "GET",
                url: "/area/get_area_by_parent/"+province_code,
                dataType:"json",
                success: function(result){
                    var html ='';
                    $.each(result, function(i, obj) {
                        html += '<option value="'+obj.area_code+'">'+obj.area_name+'</option>';
                    });
                    $("#city").append(html);
                    form.render('select');
                    layer.close(ii);
                }
            });
        });

        form.on('select(city)',function(data){
            var ii = layer.load();
            var city_code = data.value;
            $("#city_name").val($("#city option:selected").text())
            $("#area_name").val('');
            $("#district").html('<option value="">请选择区域</option>');
            form.render('select');
            $.ajax({
                type: "GET",
                url: "/area/get_area_by_parent/"+city_code,
                dataType:"json",
                success: function(result){
                    var html ='';
                    $.each(result, function(i, obj) {
                        html += '<option value="'+obj.area_code+'">'+obj.area_name+'</option>';
                    });
                    $("#district").append(html);
                    form.render('select');
                    layer.close(ii);
                }
            });
        });

        form.on('select(district)',function(data){
            $("#area_name").val($("#district option:selected").text())
        });

        var start = {
            max: '2099-06-169'
            ,istoday: false
            ,format: 'YYYY-MM-DD'
            ,choose: function(datas){
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
            }
        };
      
        var end = {
            max: '2099-06-16'
            ,istoday: false
            ,format: 'YYYY-MM-DD'
            ,choose: function(datas){
            start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
      
        document.getElementById('start_time').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('end_time').onclick = function(){
            end.elem = this
            laydate(end);
        }
    });
</script>